<?php
/* OpenManage
 * Configuration Retrieval
 * getConfig.php
 * Released under the GNU General Public Licnese version 3
 */

/* @depreceated
 * @author Ciaran Crocker <ciaran.crocker5@gmail.com>
 */
function getScriptMethod() {
    $method = $_SERVER['REQUEST_METHOD'];
    return $method;
}
/* Checks if request was POSTed
 * @author Ciaran Crocker <ciaran.crocker5@gmail.com>
 */
function isPost() {
	if(defined($_POST)) {
		return true;
	}else{
		return false;
	}
}


/* Checks if request was GETed
 * @author Ciaran Crocker <ciaran.crocker5@gmail.com>
 */
function isGet() {
	if(defined($_GET)) {
		return true;
	}else{
		return false;
	}
}

/* Gets specified variable from the headers
 * @author Ciaran Crocker <ciaran.crocker5@gmail.com>
 * @return 
 */
function getScriptVariable($varname) {
    if(isGet()) {
    	$got = $_GET[$varname];
    }elseif(isPost()){
    	$got = $_POST[$varname];
    }
    return $got;
}

/* Dumps all header variables to associative variables
 * @author Ciaran Crocker <ciaran.crocker5@gmail.com>
 * @returns null
 */

function dumpVariables() {
	if(isGet()) {
		foreach($_GET as $var => $contents) {
			$$var = $contents;			
		}
	}elseif(isPost()) {
		foreach($_POST as $var => $contents) {
			$$var = $contents;
		}
	}
}
?>
